package cn.com.thinvent.dispatch.web.controller;

import cn.com.thinvent.dispatch.entity.DataCleaStoreConfig;
import cn.com.thinvent.dispatch.entity.ModelDatasource;
import cn.com.thinvent.dispatch.entity.ModelFiletag;
import cn.com.thinvent.dispatch.entity.ModelTarget;
import cn.com.thinvent.dispatch.entity.response.PagedGridResult;
import cn.com.thinvent.dispatch.entity.response.ReturnModel;
import cn.com.thinvent.dispatch.service.biz.DataCleaStoreConfigService;
import cn.com.thinvent.dispatch.service.biz.DataSourceService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Api(description = "结果配置模块")
@Controller
@RequestMapping("/DataCleaStoreConfig")
@CrossOrigin(origins = "*")
@ResponseBody
public class DataCleaStoreConfigController {
    @Autowired
    private DataCleaStoreConfigService dataCleaStoreConfigService;

    /**
     * 结构化数据源列表
     * @param pageNum
     * @param pageSize
     * @return
     */
    @GetMapping("/list")
    @ResponseBody
    public ReturnModel list(@RequestParam("pageNum") Integer pageNum,
                            @RequestParam("name") String name,
                            @RequestParam("pageSize") Integer pageSize) {
        PagedGridResult<DataCleaStoreConfig> list = dataCleaStoreConfigService.list(pageNum, pageSize,name);
        return new ReturnModel(200, list, "");
    }

    @PostMapping("/saveOrUpdate")
    @ResponseBody
    public ReturnModel saveOrUpdate(@RequestBody DataCleaStoreConfig dataCleaStoreConfig) {
        DataCleaStoreConfig target = dataCleaStoreConfigService.saveOrUpdate(dataCleaStoreConfig);
        return new ReturnModel(200, target, "");
    }
    @GetMapping("/delete")
    @ResponseBody
    public ReturnModel delete(@RequestParam("id") Integer id) {
        Integer delete = dataCleaStoreConfigService.del(id);
        return new ReturnModel(200, delete, "");
    }

}
